package com.qd.common.sys.domain.entity.org;

import com.cdqidi.valid.group.DefaultGroup;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author sjk
 * 机构和人员
 */
@Data
@Accessors(chain = true)
public class OrgPersonsDTO {

    @NotBlank(message = "机构ID不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "机构ID长度不能超过{max}位", groups = DefaultGroup.class)

    private String orgId;
    @NotEmpty(message = "人员ID不能为空")
    private List<String> personIds;

    public void freeData() {
        this.orgId = null;
        if (null != personIds) {
            personIds.clear();
        }
    }
}
